package com.example.guide.validdata;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.time.LocalDateTime;

@Data
public class ValidTest {
    @NotNull(message = "Id不能为空")
    private Long id;

    @NotNull(message = "用户账号不能为空")
    @Size(min = 6, max = 11, message = "账号长度必须是6-11个字符")
    private String account;

    @NotNull(message = "用户密码不能为空")
    @Size(min = 6, max = 11, message = "密码长度必须是6-16个字符")
    private String password;

    @NotNull(message = "用户邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    @NotEmpty(message = "姓名不能为空")
    private String name;

    @Max(value = 18,message = "年龄不能超过18岁")
    private String age;

    @Max(value = 1, message = "性别只能为0和1: 0=女1=男")
    @Min(value = 0, message = "性别只能为0和1: 0=女1=男")
    private Short sex;

  //  @DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
   @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone = "GMT+8")
    private LocalDateTime joinDate;
}
